<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>用户中心</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <link rel="stylesheet" href="css/font-awesome.css">
  <link rel="stylesheet" href="css/ionicons.css">
  <link rel="stylesheet" href="css/AdminLTE.css">
  <link rel="stylesheet" href="css/skin-blue.min.css">
	<link rel="stylesheet" type="text/css" href="css/toastr.min.css">
  <link rel="icon" href="images/logo.ico" type="image/x-icon">
  <link rel="stylesheet" type="text/css" href="css/animate.css">
  <link rel="stylesheet" type="text/css" href="css/style.css">
  <link rel="stylesheet" type="text/css" href="css/my.css">
  <link rel="stylesheet" type="text/css" href="css/colleges.css">
  <link rel="stylesheet" type="text/css" href="css/lss.css">
  <link rel="stylesheet" type="text/css" href="css/expert.css">
  <link rel="stylesheet" type="text/css" href="css/expertList.css">
  <link rel="stylesheet" href="css/myCommon.css">
  <link rel="stylesheet" type="text/css" media="screen and (max-width: 500px)" href="css/phoneAuto.css" />
  <!-- 我的评价 -->
  <link rel="stylesheet" href="css/myComments.css">
  <script src="js/browser-polyfill.js"></script>
  <script src="js/jquery.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script src="js/adminlte.js"></script>
  <script src="js/comments.js"></script>
  <script src="js/toastr.min.js"></script>
  <script src="js/main.js"> </script>
	<script src="js/jrn.js"> </script>
</head>

<body class="hold-transition skin-blue sidebar-mini">
  <div class="wrapper">

    <header class="main-header">
      <!-- Logo -->
      <a href="javascript:void(0)" class="logo">
        <img src="images/footerlogo.png" style="max-width: 100%;max-height: 100%" alt="">
      </a>


      <nav class="navbar navbar-static-top" role="navigation">
        <a href="javascript:void(0)" class="sidebar-toggle" data-toggle="push-menu" role="button">
          <span class="sr-only"> </span>
        </a>
        <div class="navbar-custom-menu">
          <ul class="nav navbar-nav">
            <!-- <li class="dropdown messages-menu">
              <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-envelope-o"></i>
                <span class="label label-success">4</span>
              </a>
              <ul class="dropdown-menu">
                <li class="header">你有4条新消息</li>
                <li>
                  <ul class="menu">
                    <li>
                      <a href="javascript:void(0)" >
                        <div class="pull-left">
                          <img src="images/defultHeader.png" class="img-circle userThumb" alt="User Image">
                        </div>
                        <h4>
                          预约成功
                          <small><i class="fa fa-clock-o"></i> 5 分钟前</small>
                        </h4>
                        <p>您的课程...预约成功了</p>
                      </a>
                    </li>

                    <li>
                      <a href="javascript:void(0)" >
                        <div class="pull-left">
                          <img src="images/defultHeader.png" class="img-circle userThumb" alt="User Image">
                        </div>
                        <h4>
                          你的课程评论完成
                          <small><i class="fa fa-clock-o"></i> 15 分钟前</small>
                        </h4>
                        <p>您已观看的课程《。。。》评论有回复</p>
                      </a>
                    </li>
                  </ul>
                </li>
                <li class="viewALl"><a href="javascript:void(0)"  >查看所有</a></li>
              </ul>
            </li> -->

            <li class="dropdown user user-menu">
              <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
                <img src="images/defultHeader.png" class="user-image userThumb"  alt="User Image">
                <span class="hidden-xs userName" ></span>
              </a>

            </li>
            <li>
              <a href="javascript:void(0)" data-toggle="control-sidebar" title="返回首页">
                <i class="fa fa-university" onclick="goBAck()"></i>
            </a>
            </li>
          </ul>
        </div>
      </nav>
    </header>

    <aside class="main-sidebar">
      <section class="sidebar">
        <div class="user-panel">
          <div class="pull-left image">
            <img src="images/defultHeader.png" class="img-circle userThumb" alt="User Image">
          </div>
          <div class="pull-left info">
            <p class="userName"></p>
            <a href="javascript:void(0)"><i class="fa fa-circle text-success"></i> 在线</a>
          </div>
        </div>

        <ul class="sidebar-menu" data-widget="tree">
          <li class="treeview menu-open" >
            <a href="javascript:void(0)">
              <i class="fa fa-link"></i> <span class="fontWeight">个人中心</span>
              <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
              </span>
            </a>
            <ul class="treeview-menu" id="treeview_menu" style="display: block;">
              <li data="myInfo" class="active"><a href="javascript:void(0)" class="myLeftMenu">基础信息</a></li>
              <li data="changeMyPassword"><a href="javascript:void(0)" class="myLeftMenu">修改密码</a></li>
            </ul>
          </li>
          <li class="treeview">
            <a href="javascript:void(0)"><i class="fa fa-link"></i> <span class="fontWeight">我的</span>
              <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
              </span>
            </a>
            <ul class="treeview-menu" id="treeview_menu">
              <li data="myAppointment"><a href="javascript:void(0)" class="myLeftMenu">我的预约</a></li>
              <li data="myOrder"><a href="javascript:void(0)" class="myLeftMenu">我的课程</a></li>
              <!-- <li data="myComments"><a href="javascript:void(0)" class="myLeftMenu">课程评价</a></li> -->
              <li data="myCollection"><a href="javascript:void(0)" class="myLeftMenu">我的收藏</a></li>
              <li data="curriculum_Comments"><a href="javascript:void(0)" class="myLeftMenu">我的评论</a></li>
              <li data="myfollow"><a href="javascript:void(0)" class="myLeftMenu">我的关注</a></li>
              <li data="myQuestion"><a href="javascript:void(0)" class="myLeftMenu">我的提问</a></li>

            </ul>
          </li>

        </ul>
        <!-- /.sidebar-menu -->
      </section>
      <!-- /.sidebar -->
    </aside>

    <div class="content-wrapper">
      <!-- 课程评价 -->
      <section class="content container-fluid" id="myComments" hidden>
        <div id="mycomments">

        </div>
      </section>
      <!-- 课程评价结尾 -->

      <!-- 我的评价 -->
      <section class="content container-fluid " id="curriculum_Comments" hidden>
        <div id="curriculumComments">
          <div id="curriculumCommentsContent"></div>
        </div>
        <div class="viewMore" onclick="viewMoreComment()" hidden>查看更多</div>
        <div class="nocontent">没有更多内容了</div>
      </section>
      <!-- 我的评价结尾 -->


      <!-- 我的收藏 -->
      <section class="content container-fluid" id="myCollection" hidden>
        <div id="collection">
        </div>

      </section>
      <!-- 我的收藏结尾 -->


      <!-- 我的订单 -->
      <section class="content container-fluid" id="myOrder" hidden>
        <div id="order">

        </div>
        <div class="viewMoreOrder" onclick="viewMoreOrder()" hidden>查看更多</div>
        <div class="noOrderContent">没有更多内容了</div>
      </section>
      <!-- 我的订单结尾 -->

      <!--我的预约 start-->
      <section class="content container-fluid" id="myAppointment" hidden>
        <div class="lessonBox " id="appointment" >
        </div>
      </section>
      <!--我的预约 end-->


      <!--我的关注 start-->
      <section class="content container-fluid" id="myfollow" hidden>
        <div class="contentflur contentflur-reset">
          <div class="big-box">
              <div class="coolleges-box coolleges-box-reset  col-md-12 col-sm-12 col-xs-12">
                  <div class="topic-w-box  col-md-12 col-sm-12 col-xs-12">
                      <div id='expertContent'>

                      </div>
                  </div>
              </div>

          </div>
      </div>
      </section>
      <!--我的关注 end-->

      <!--我的提问 start-->
      <section class="content container-fluid" id="myQuestion" hidden>
        <div class="contentflur contentflur-reset">
          <div class="big-box">
              <div class="coolleges-box coolleges-box-reset  col-md-12 col-sm-12 col-xs-12">
                  <div class="topic-w-box  col-md-12 col-sm-12 col-xs-12">
                      <div id='myQuestionBox'>

                      </div>
                  </div>
              </div>

          </div>
      </div>
      </section>
      <!--我的提问 end-->
      <!--基本信息 start-->
      <section class="content container-fluid" id="myInfo">
        <div class="my_info " id="my_info" >
          <div class="myHeaderImg">
            <img src="images/defultHeader.png" id="userHeader" class="userThumb" onclick="imageOnClick()" alt="" title="点击更换头像">
          </div>
          <div class="userName"></div>
          <div class="comflex info-item">
            <span class="info-tit">所属机构:</span> <span class="organzi_name"></span>
          </div>
          <div class="comflex info-item">
            <span class="info-tit">手机号码:</span> <span class="my_phone"></span>
          </div>
          <div class="change-btn" id="change-btn">修改信息</div>
        </div>
        <!-- <input type="file" style="display: none;" id="changeHeader" > -->
        <!-- //修改信息弹框 -->
        <div class="model-box" id="model-box" hidden>
          <div class="pice-box">
            <img src="images/defultHeader.png" id="userHeaderModel" class="userThumb" onclick="imageOnClick()" alt="" title="点击更换头像">
          </div>
          <div class="change-img">
            <div class="change-title">点击修改</div>
            <input type="file" id="change-title-btn" >
          </div>
          <div class="changeName-box">
            <input type="text" id="changeUser" class="userPhone loginInput" placeholder="" autocomplete="off"/>
          </div>
          <div class="sure-box">
            <div class="appointmentbtn change-sure" id="change-sure">确定</div>
            <div class="appointmentbtn change-no" id="change-no">取消</div>
          </div>
        </div>
      </section>
    <!--基本信息 end-->

    <!--修改密码 start-->
    <section class="content container-fluid" id="changeMyPassword" hidden>
      <div class="change_password " id="change_password" >
        <div>
          <input type="password" name="password" class="oldPassword loginInput" placeholder="输入旧密码" oncontextmenu="return false"
            onpaste="return false" />
        </div>

        <div>
          <input type="password" name="password" class="newPassword loginInput" placeholder="输入新密码" oncontextmenu="return false"
            onpaste="return false" />
        </div>

        <div>
          <input type="password" name="confirm_password" class="confirm_password loginInput" placeholder="确认新密码"
            oncontextmenu="return false" onpaste="return false" />

        </div>
        <button id="submit" type="submit">确认修改</button>
      </div>
    </section>
    <!--修改密码 end-->
    </div>

    <!-- Main Footer -->
    <footer class="main-footer">
      <strong>Copyright &copy; 2020 <a href="javascript:void(0)">深圳市前海汇智保险管理咨询有限公司</a>.</strong> 未经许可不得复制、转载或摘编，违者必究.<span
        style="margin-left: 12px;">粤CIP备2020075217号</span>
    </footer>
  </div>
  <script>
    let passwordKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYqxNMjTRQIvf9JylgBaCOwdAvE3XwWJownq8K8iy5FDMaC7wYHmbw6s+B66TcOYLZFy10mUYxkV+J+epmpnIxMSdXYZ7sU2pqbB9tZmtdkiy4YLoXQUirwaZsEJSApQF/P9StfqAralyG2wguBYyujF8EdV4Kbrb5vD+QTxcwxQIDAQAB";
    let page = 1 ;defultSize=10;
    function userMainInfoLoad(){
      let userInfo={};
      try{
        if( sessionStorage.hz_userInfo){
          userInfo =  JSON.parse(sessionStorage.hz_userInfo);
        }
      }catch(err){
        userInfo={};
      }
      if (userInfo.jwt) {
        if(userInfo.companyId==1 || userInfo.companyId==2){ //有机构
          $(".organzi_name").text(userInfo.companyId==1 ? "南华经纪": "汇才代理")
        }else{
          $(".organzi_name").text(userInfo.companyName)
        }
        $(".my_phone").text(userInfo.phone);
      }else{

      }
    }
    toastr.options = {
      closeButton: false,
      debug: false,
      progressBar: true,
      positionClass: "toast-top-center",
      onclick: null,
      showDuration: "300",
      hideDuration: "1000",
      timeOut: "2000",
      extendedTimeOut: "1000",
      showEasing: "swing",
      hideEasing: "linear",
      showMethod: "fadeIn",
      hideMethod: "fadeOut"
    };


    function imageOnClick(){
      $("#changeHeader").click()
    }
    function goBAck(){
      location.href="index.html";
    }


    $(function () {
      userMainInfoLoad();
      getFavoriteList();
      $('ul.sidebar-menu li').click(function () {
        var idName = $(this).attr('data');
        if(idName){
          var li = $('ul.sidebar-menu li.active');
          li.removeClass('active');
          $(this).addClass('active');
          $("section.content").hide();
          $(`#${idName}`).fadeIn();
        }
      });
     //修改密码
     $("#submit").click(function(){
        let  params={
          oldPass:$(".oldPassword").val(),
          newPass:$(".newPassword").val(),
        }
        if(!params.oldPass){
            return toastr.info('请输入旧密码');
        }
        if(!params.newPass){
            return toastr.info('请输入新密码');
        }
        if(!$(".confirm_password").val()){
            return toastr.info('请确认密码');
        }
        if(params.newPass!==$(".confirm_password").val()){
            return toastr.info('两次输入的密码不一致');
        }

        var encrypt = new JSEncrypt();
        encrypt.setPublicKey(passwordKey);
        var oldPass = encrypt.encrypt(params.oldPass);
        params.oldPass=oldPass;
        var newPass = encrypt.encrypt(params.newPass);
        params.newPass=newPass;

        $.server(params, '/iagent/v1/updatePass').then((res) => {
            toastr.info('修改成功,请重新登录');
            setTimeout(()=>{
              location.href="login.html";
            },1000)

        })
    })

    // 更换头像
    $("#changeHeader").change(function () {//avatar_file  input[file]的ID
        // 获取上传文件对象
        var file = $(this)[0].files[0];

        // 读取文件URL
        var reader = new FileReader();
        reader.readAsDataURL(file);
        // 阅读文件完成后触发的事件
        reader.onload = function () {
            // 读取的URL结果：this.result
            console.log(this.result);
            $.server({}, '/website/v1/indexCategoryContent').then((res) => {
                console.log(res, "修改图像")
            })
            $("#userHeader").attr("src", this.result);//avatar_img  img标签的ID
        }

      })

    })
  </script>
</body>

</html>
